<!-- 组织类型修改 -->
<template>
    <div>
        <el-dialog title="组织类型变更" v-model="show" width="600px" append-to-body draggable :close-on-click-modal="false"
            align-center>
            <el-radio-group v-model="org.type">
                <el-radio v-for="(item, index) in org_type" :value="item.value" :key="index" border>
                    {{ item.label }}
                </el-radio>
            </el-radio-group>
            <template #footer>
                <div class="dialog-footer">
                    <el-button type="primary" @click="submitForm">确 定</el-button>
                    <el-button @click="cancel">取 消</el-button>
                </div>
            </template>
        </el-dialog>
    </div>
</template>
<script setup>
import { updateDeptType } from "@/api/system/dept";
import { org_type } from "./dict"

const emits = defineEmits(["onSuccess"]);


const show = ref(false);
const org = reactive({
    id: undefined,
    type: undefined,
});


const setOrg = (data) => {
    show.value = true;
    org.id = data.id;
    org.type = data.type;
}

const submitForm = () => {
    updateDeptType(org).then(res => {
        show.value = false;
        emits("onSuccess")
    })
}

const cancel = () => {
    show.value = false;
}

defineExpose({ setOrg })
</script>

<style lang="sass" scoped>

</style>